#include "Framework.h"


namespace sgeFramework
{
namespace Common
{
	void setOrthoProjection() 
	{
		// switch to projection mode
		glMatrixMode(GL_PROJECTION);
		// save previous matrix which contains the 
		//settings for the perspective projection
		glPushMatrix();
		// reset matrix
		glLoadIdentity();
		// set a 2D orthographic projection
		gluOrtho2D(0, WYSOKOSC, 0, SZEROKOSC);
		// invert the y axis, down is positive
		glScalef(1, -1, 1);
		// mover the origin from the bottom left corner
		// to the upper left corner
		glTranslatef(0, -SZEROKOSC, 0);
		glMatrixMode(GL_MODELVIEW);
	}
	void resetPerspectiveProjection() 
	{
		glMatrixMode(GL_PROJECTION);
		glPopMatrix();
		glMatrixMode(GL_MODELVIEW);
	}
	
	
	
	namespace Font
{
		


GLvoid BuildFont(GLvoid)								// Build Our Bitmap Font
	{
		HFONT	font;										// Windows Font ID
		HFONT	oldfont;									// Used For Good House Keeping

		base = glGenLists(96);								// Storage For 96 Characters

		font = CreateFont(	-14,							// Height Of Font
							0,								// Width Of Font
							0,								// Angle Of Escapement
							0,								// Orientation Angle
							FW_BOLD,						// Font Weight
							FALSE,							// Italic
							FALSE,							// Underline
							FALSE,							// Strikeout
							ANSI_CHARSET,					// Character Set Identifier
							OUT_TT_PRECIS,					// Output Precision
							CLIP_DEFAULT_PRECIS,			// Clipping Precision
							ANTIALIASED_QUALITY,			// Output Quality
							FF_DONTCARE|DEFAULT_PITCH,		// Family And Pitch
							"Courier New");					// Font Name

		oldfont = (HFONT)SelectObject(hDC, font);           // Selects The Font We Want
		wglUseFontBitmaps(hDC, 32, 96, base);				// Builds 96 Characters Starting At Character 32
		SelectObject(hDC, oldfont);							// Selects The Font We Want
		DeleteObject(font);									// Delete The Font
	}

GLvoid KillFont(GLvoid)									// Delete The Font List
	{
		glDeleteLists(base, 96);							// Delete All 96 Characters
	}

GLvoid glPrint(const char *fmt, ...)					// Custom GL "Print" Routine
	{
		char		text[256];								// Holds Our String
		va_list		ap;										// Pointer To List Of Arguments

		if (fmt == NULL)									// If There's No Text
			return;											// Do Nothing

		va_start(ap, fmt);									// Parses The String For Variables
			vsprintf(text, fmt, ap);						// And Converts Symbols To Actual Numbers
		va_end(ap);											// Results Are Stored In Text

		glPushAttrib(GL_LIST_BIT);							// Pushes The Display List Bits
		glListBase(base - 32);								// Sets The Base Character to 32
		glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);	// Draws The Display List Text
		glPopAttrib();										// Pops The Display List Bits
	}



	
	};// end of namespace sgeFramework::Common::Font
	
	namespace Profiler
	{
	
	
	};// end of namespace sgeFramework::Common::Profiler
	
}; // end of namespace sgeFramework::common







}
